# num = input("输入一个六位数")
# sum = 0
# for i in num:
#     print(i)
#     sum += eval(i)
#
# print(sum)

data = input("输入四位整数")
m = []
for i in data:
    temp = eval(i)
    m.append((temp+5)%10)
print(m)
m[0], m[3] = m[3], m[0]
m[2], m[1] = m[1], m[2]
print(m)

for i in m:
    print(i, end="")